<script setup lang='ts'>
import {ref} from 'vue'
       import Child from './14_父子通信中的子组件.vue'
import { EmitFlags } from 'typescript';
       const name = ref('张三') //声明响应式数据
       const age = ref(12)
const changeInfo =()=>{
    name.value ='李四'
    age.value++
}
// 实现子传父 回调函数形式
const receiveFunc =( count:number)=>{
    age.value = count    
}

const receiveNameFunc =(aname:string)=>{
    name.value = aname
}
const receiveAll =(count:number,aname:string)=>{
    name.value = aname
    age.value = count
}
</script>
       
<template>
    <h2>当前父组件</h2>
    <p>姓名：{{ name }}</p>
    <p>年龄：{{ age }}</p>
    <button @click="changeInfo">修改内容</button>
       <Child :name="name" :age="age"
       :func="receiveFunc"
       @update-age="receiveFunc" @update-name="receiveNameFunc"
        @update-all="receiveAll"></Child>
</template>
       
<style scoped>
       
</style>